#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

#include <QResizeEvent>
#include <QTcpSocket>
#include <QHostAddress>


#include "resizeui.h"
#include "form.h"

#include "recvaudio.h"
#include "sendaudio.h"
#include "soundserver.h"

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
    void resizeEvent(QResizeEvent *event);


    void init();

    bool cmp_str(char str[], char substr[])
    {
        if(strlen(str)<strlen(substr))
            return false;
        for(int i=0;i<strlen(substr);i++)
        {
            if(str[i]!=substr[i])
            {
                return false;
            }
        }
        return true;
    }
    void recvMess(QByteArray buf); 

    void setVisibles(bool v);


private slots:
    void on_pushButton_clicked();

    void on_pushButton_2_clicked();

    void on_pushButton_3_clicked();

    void on_pushButton_4_clicked();

    void on_pushButton_5_clicked();

    void on_pushButton_7_clicked();

    void on_pushButton_6_clicked();

private:
    Ui::MainWindow *ui;
    Form sendUi;
    ResizeUI resizeUi;

    QTcpSocket  *tcpSocket;//通信套接字

    RecvAudio clientRecv;
    SendAudio *clientSend;

    bool isRecving=false;

    int serverSendDelay=3;

    SoundServer *soundServer;
    QString src_ip;
};

#endif // MAINWINDOW_H
